package com.jieshuibao.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jieshuibao.mapper.LiveroomMapper;
import com.jieshuibao.model.db.Liveroom;
import com.jieshuibao.model.db.LiveroomExample;

@Service
public class LiveroomService{
	
	@Resource
	private LiveroomMapper liveroomMapper;
	
	public void addLiveroom(Liveroom liveroom) {
		liveroomMapper.insertSelective(liveroom);
	}
	
	public void delLiveroomByRoomId(String roomId) {
		liveroomMapper.deleteByPrimaryKey(roomId);
	}
	
	public void updateLiveroom(Liveroom liveroom) {
		liveroomMapper.updateByPrimaryKeySelective(liveroom);
	}
	
	public void updateLiveroomByExample(Liveroom liveroom,LiveroomExample liveroomExample){
	    liveroomMapper.updateByExampleSelective(liveroom,liveroomExample);
	}
	
	public Liveroom getLiveroomByRoomId(String roomId) {
		return liveroomMapper.selectByPrimaryKey(roomId);
	}
	
	public List<Liveroom> getPageLiveroom(LiveroomExample liveroomExample) {
		return liveroomMapper.selectPage(liveroomExample);
	}
	
	public int countLiveroom(LiveroomExample liveroomExample) {
		return liveroomMapper.countByExample(liveroomExample);
	}
	
	public List<Liveroom> selectByExample(LiveroomExample example){
	    return liveroomMapper.selectByExample(example);
	}
}
